|
|
what is wrong with this script , it compiles perfectly but the object donest move in game :|
Begin Move_ship_up if (activate == 1) airship -> move y, 100 Ship_controls_up -> move y, 100 Airship_door -> move y, 100 endif end Move_ship_up
-------------------- You...Must help...me.. or ill go insane!!!!
-currently constructing an airship ;P
Post Extras:
|
Mode_Locrian
|
Diviner
|
|
|
Reged: 10/07/02
|
Posts: 2084
|
Loc: Bjornholm, Rykith Lowlands Region
|
|
|
Oh, it moves, but it doesn't move very far. Try activating it a bunch of times, and you'll gradually see the that pieces have moved along the y-axis.
There are a couple of problems here. First, if you want to use move or moveWorld, you can't just tell the object to move; you have to tell it to move per unit of time. Second, onActivate only returns true for one frame, so it will only move as far as it can go in one frame, which isn't very far.
try this:
Code:
Begin Move_ship_up
short move float timer
if (activate == 1) if ( move == 1 ) return ; don't do anything if it's already moving elseif ( move == 0 ) set move to 1 endif endif
if ( move == 1 ) set timer to timer + GetSecondsPassed if ( timer <= 2 ) airship -> moveWorld, y, 50 Ship_controls_up -> moveWorld, y, 50 Airship_door -> moveWorld, y, 50 elseif ( timer > 2 ) airship -> setpos, y, 50 ;instead of 50 enter whatever the y-value should be when it is finished moving Ship_controls_up -> setpos, y, 50;ditto Airship_door -> setpos, y, 50;ditto set move to 0 set timer to 0 endif endif
end Move_ship_up
Now, there will still be some funny issues with this, but that's just because I'm not exactly sure what you're trying to do, so I didn't bother to code other parameters. For instance, after you've moved it, if you activate it again, it will continue moving along the y-axis, and then snap back to its original position. This is easy enough to fix, but I didn't bother with it because I don't know what you're trying to do.
-------------------- My Website
Bards of Vvardenfell Thread (New Info 8/15/04)
Post Extras:
|
|
|
i dont think you understand.....
i want it to keep moving everytime i press the switch that piece of code isnt what im looking for ,
i dont need a timer i want the ship to move up everytime i click it, but its just not working!
-------------------- You...Must help...me.. or ill go insane!!!!
-currently constructing an airship ;P
Post Extras:
|
Mode_Locrian
|
Diviner
|
|
|
Reged: 10/07/02
|
Posts: 2084
|
Loc: Bjornholm, Rykith Lowlands Region
|
|
|
You just want it to move 100 units every time you click on it? Well, that's even easier. (Also, you say you want it to move up, but you're using the y-axis? Up/down is on the z-axis, so I'll assume that's what you want).
begin Airship_move_thingy
float zPos1 float zPos2 float zPos3
set zPos1 to airship -> GetPos, z set zPos2 to ship_controls_up -> GetPos, z set zPos3 to airship_door -> getPos, z
if ( onActivate == 1 ) set zPos1 to zPos1 + 100 set zPos2 to zPos2 + 100 set zPos3 to zPos3 + 100 airship -> setPos, z, zPos1 ship_controls_up -> setPos, z, zPos2 airship_door -> setPos, z, zPos3 endif
end
-------------------- My Website
Bards of Vvardenfell Thread (New Info 8/15/04)
Post Extras:
|
|
|
it was so tense , i clicked the switch, it lagged for a sec then..... it disappeared, i guess it went to far to fast?, it still shows up on my map...and i set my acrobatics to 8000 but i couldnt see it up there either.... O_O
-------------------- You...Must help...me.. or ill go insane!!!!
-currently constructing an airship ;P
Post Extras:
|
|
|
you must help me or ill go insane!
-------------------- You...Must help...me.. or ill go insane!!!!
-currently constructing an airship ;P
Post Extras:
|
Mode_Locrian
|
Diviner
|
|
|
Reged: 10/07/02
|
Posts: 2084
|
Loc: Bjornholm, Rykith Lowlands Region
|
|
|
Hmm... well, that's somewhat surprising. Let's try adding a doOnce condition, though it shouldn't need it, as OnActivate should only be true for one frame...
begin Airship_move_thingy
short doOnce float zPos1 float zPos2 float zPos3
if ( doOnce > 0 ) set doOnce to 0 endif
if ( onActivate == 1 ) if ( doOnce == 0 ) set zPos1 to airship -> GetPos, z set zPos2 to ship_controls_up -> GetPos, z set zPos3 to airship_door -> getPos, z set zPos1 to zPos1 + 100 set zPos2 to zPos2 + 100 set zPos3 to zPos3 + 100 airship -> setPos, z, zPos1 ship_controls_up -> setPos, z, zPos2 airship_door -> setPos, z, zPos3 set doOnce to 1 return endif
end
Now that I think about it, you might be able to dispense with the doOnce; the problem might have been that the position was getting set every frame.
-------------------- My Website
Bards of Vvardenfell Thread (New Info 8/15/04)
Post Extras:
|
TheSlof
|
Curate
|
|
|
Reged: 03/16/04
|
Posts: 425
|
Loc: Trollhättan, Sweden
|
|
|
Isn't there a command called MoveWorld?
From MSFD8:
Quote:
Moving along the world axis MoveWorld axis(x/y/z), units/sec_enum MoveWorld z, 100 Object_ID -> MoveWorld Z, 30 Moves the object along the selected world axis (x, y, or z) at the speed selected. This speed is in units per second (21.3 units per foot). This movement is based on the world axis, thus a positive z movement will always move the object up, regardless of it’s local rotation: In world coordinates Z is always up / down (increasing upwards), X is east / west (increasing to east) and Y is north / south (increasing to north). Note: MoveWorld will not work on Actors, including the player. Use SetPos for actors. This is an example after a script I once picked up on the forums that makes a platform slowly move out and back once the player stands on it:
Code:
Begin platform_script Short PlatformMoving Short ActivateMe Float Timer
If ( GetStandingPC == 1 ) Set ActivateMe to 1 Endif If ( ActivateMe == 1 ) If ( PlatformMoving == 0 ) Set Timer to Timer + GetSecondsPassed If ( Timer <= 15 ) "floating_platform_01"->MoveWorld X 10 Else Set Timer to 0 Set PlatformMoving to -1 Endif Endif If ( PlatformMoving == -1 ) Set Timer to Timer + GetSecondsPassed If ( Timer <= 15 ) "floating_platform_01"->MoveWorld X -10 Else Set Timer to 0 Set PlatformMoving to 0 Set ActivateMe to -1 Endif Endif Else "floating_platform_01"->SetAtStart Endif End platform_script
-------------------- My tutorials:
Here or here!
||||||
Post Extras:
|
|
|
ARRGH!!!!!!! it still just "disappears" when you press the button!!!!!
i cant understand it!
and yes i have MSFD8 but that donest help either.
-------------------- You...Must help...me.. or ill go insane!!!!
-currently constructing an airship ;P
Post Extras:
|
Mode_Locrian
|
Diviner
|
|
|
Reged: 10/07/02
|
Posts: 2084
|
Loc: Bjornholm, Rykith Lowlands Region
|
|
|
Here's a question... is this mod dependant on Tribunal? If not, the script I posted won't work correctly, as setPos doesn't take variables in normal MW.
edit: I just made a mini plugin and tested the script ingame. It works perfectly. So, you're either not implementing it correctly, or you don't have tribunal or something, but the script is does exactly what you want AFAIK.
Here is the working script that I used.
Code:
begin Airship_move_thingy
float zPos1
float zPos2
float zPos3
if ( onActivate == 1 )
set zPos1 to airship -> GetPos, z
set zPos2 to ship_controls_up -> GetPos, z
set zPos3 to airship_door -> getPos, z
set zPos1 to zPos1 + 100
set zPos2 to zPos2 + 100
set zPos3 to zPos3 + 100
airship -> setPos, z, zPos1
ship_controls_up -> setPos, z, zPos2
airship_door -> setPos, z, zPos3
return
endif
end
-------------------- My Website
Bards of Vvardenfell Thread (New Info 8/15/04)
Edited by Mode_Locrian (08/23/04 03:26 PM)
Post Extras:
|